GBML manual / Events

path_end

Runs when this instance reaches the end of its current path - once for PATH_STOP/PATH_CONTINUE, every lap for PATH_LOOP, every bounce for PATH_PING_PONG (path_start’s own end_action decides which).

Syntax

path_end: fires when this instance reaches the end of its path

Description

Runs when this instance reaches the end of its current path: once for PATH_STOP/PATH_CONTINUE, every lap for PATH_LOOP, every bounce for PATH_PING_PONG - whichever end action path_start was given decides which of those shapes this instance's own path-following takes, and so how often this event fires. See Rooms for how a path is assigned to an instance from the Room Editor tab in the first place.

Assigning a path to an instance from the editor adds a stub Path End event to its object automatically if it does not already have one, since a patrol with no reaction to reaching its own end is an easy thing to forget.

Example

facing needs to already exist before Path End can flip it, so it starts out declared in Create (see Variables, types and scope):

facing = 1;

Then, in Path End itself:

facing = -facing;

Flips this patrolling instance's own facing (declared above, in Create) every time it reaches an end of its path.

On the GBA

Bound through gbml::object_def::run_paths - the same "data field here, the per-instance loop bound once per object type" shape Room Start/Room End already use.

See also: path_startpath_end_doRoomsEvents